import 'package:flutter/cupertino.dart';
import 'package:flutter_shader/pages/clouds_page.dart';
import 'package:flutter_shader/pages/ed_page.dart';
import 'package:flutter_shader/pages/home_page.dart';
import 'package:flutter_shader/pages/image_page.dart';
import 'package:flutter_shader/pages/inercia_page.dart';
import 'package:flutter_shader/pages/mandelbulb_page.dart';
import 'package:flutter_shader/pages/mario_page.dart';
import 'package:flutter_shader/pages/ocean_page.dart';
import 'package:flutter_shader/pages/phantom_page.dart';
import 'package:flutter_shader/pages/primitives_page.dart';
import 'package:flutter_shader/pages/silexars_page.dart';
import 'package:flutter_shader/pages/siri_page.dart';
import 'package:flutter_shader/pages/water_page.dart';

void main() {
  runApp(const App());
}

/// 路由
enum R {
  /// 首页
  root(HomePage()),

  /// 图片
  image(ImagePage()),

  /// 大海
  water(WaterPage()),

  /// 元素
  primitives(PrimitivesPage()),

  /// 机器人
  ed(EdPage()),

  /// Silexars
  silexars(SilexarsPage()),

  /// Phantom
  phantom(PhantomPage()),

  /// MandelbulbPage
  mandelbulb(MandelbulbPage()),

  /// ocean
  ocean(OceanPage()),

  /// clouds
  clouds(CloudsPage()),

  /// inercia
  inercia(InerciaPage()),

  /// mario
  mario(MarioPage()),

  /// 测试
  siri(SiriPage()),

  // end
  ;

  const R(this.child);

  /// child
  final Widget child;

  /// 路由
  String get routeName => this == root ? '/' : name;

  /// 构建child
  Widget build(BuildContext context) => child;
}

/// App
class App extends StatelessWidget {
  /// App
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'Flutter Shader',
      theme: const CupertinoThemeData(
        barBackgroundColor: CupertinoColors.secondarySystemBackground,
        scaffoldBackgroundColor: CupertinoColors.systemBackground,
      ),
      routes: Map.fromEntries(R.values.map((e) => MapEntry(e.routeName, e.build))),
    );
  }
}
